import React, {Component} from 'react';
import _ from '../../utils/lodash.js';
import {Button} from 'antd';
import './styles.scss';

class Test extends Component {
    constructor(props) {
        super(props)
    }

    componentDidMount() {
        this.test();
    }

    onClick = (type) => {
        /*let a = {"name": "葛文杰"};
        let b = a;
        console.log(b === a);
        let c = _.cloneDeep(a);
        console.log(c === a);
        let array = [6.1, 4.2, 6.3];
        let groupArray = _.groupBy(array, Math.floor);
        console.log(groupArray);*/
        let nodes = [1, 2, 3, 4, 5, 66, 111];
        nodes.forEach(node => {
            if (_.findIndex(newData.nodes, d => {
                return d === node.id;
            }) !== -1) {
                node.remove = true;
            }
        });
    };

    ce = () => {
        alert(111);
    }

    test = () => {
        Object.prototype.toString = function () {
            debugger;
            let str = '{';
            for (let tmp in this) {
                if (typeof this[tmp] === 'object')
                    str += tmp + ':' + this[tmp] + ',';
                else
                    str += tmp + ':"' + this[tmp] + '",'
            }
            return str + '}'
        }
        let o = {
            a: '1',
            b: {
                c: '1',
                d: {
                    e: '1'
                }
            }
        }
        let a = new Object();
        console.log(a.__proto__);
        console.log(a.__proto__.__proto__);
        a = "1111111";
        console.log(a.toString());
    };

    render() {
        return (
            <div className="testClass">
                <Button type='default' onClick={() => this.onClick(111)}>按钮</Button>
            </div>
        );
    }
}

export default Test;